package com.itheima.service.impl;

import com.itheima.dao.AccountDao;
import com.itheima.domain.Account;
import com.itheima.service.AccountService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

@Service
@Transactional
public class AccountServiceImpl implements AccountService {

    @Autowired
    private AccountDao accountDao;

    @Override
    public void transfer(Integer outId, Integer inId, Double money) {
        //outId减100元
        accountDao.transfer(outId,-money);
       //int i=1/0;
        //inId加100元
        accountDao.transfer(inId,money);
    }
}
